package com.le.tester.imooc.ccmouse.common;

/**
 * 描述：链表节点(只能拿头节点进行操作)
 */
public class Node {

    //链表中的值
    private final int value;

    //节点指的还是Node，链表中的next
    private Node next;

    public Node(int value) {
        this.value = value;
        //让node 总是指向null
        this.next = null;
    }

    public int getValue() {
        return value;
    }

    public Node getNext() {
        return next;
    }

    public void setNext(Node next) {
        this.next = next;
    }

    public static void printLinkedList(Node head) {
        while (head != null) {
            System.out.print(head.getValue());
            System.out.print(" ");
            head = head.getNext();
        }
        System.out.println();
    }
}
